#ifndef TEMPIRITORNOL_H
#define TEMPIRITORNOL_H

#include <QList>
#include <QtGui> // SERIALIZZAZIONE

#include "tempiritorno.h"
#include "pkeyitem.h"
#include "pkeylist.h"
#include "filebased.h"
#include "savingstate.h"

class TempiRitornoL :
        virtual public PKeyList,
        virtual public PReport,
        virtual public FileBased,
        virtual public SavingState
{
public:
    TempiRitornoL();
    ~TempiRitornoL();
    TempiRitornoL(const ExaTabRef& id_tab);

    // Overridding for [PKeyList] class pure virtual
    virtual const TempiRitorno&    getAt ( int i ) const;
    virtual                 int   sizeOf ( void  ) const;
    virtual       TempiRitorno&  valueAt ( int i );
    virtual                void   remove ( int i );
    virtual                void insertAt ( int i, int nb );
    virtual        void   rename(          int  i,
                                  const string& key,
                                  const string& descr);

    // Overridding for [PReport] class pure virtual
    virtual void reportMake( const string& objname = "" ) const;

    // Overridding for [FileBased]
    virtual ExaFileErr fileSave (const string& file_name) const;
    virtual ExaFileErr fileOpen (const string& file_name);
    virtual ExaFileObj  fileObj ( void ) const;

    // Overridding for [SavingState] class pure virtual
    virtual void    save ( void );
    virtual void restore ( void );

protected:
    // Overridding for [PKeyList] class pure virtual
    virtual bool hasRefAt( int i, const PKeyItem& k ) const;
    virtual bool setRefAt( int i, const PKeyItem& k );

private:
    QList < TempiRitorno > m_list;
    QList < TempiRitorno > m_list_cache;
    static string m_objname;
    static ExaFileObj m_file_obj; // for [FileBased]
};

Q_DECLARE_METATYPE(TempiRitornoL) // SERIALIZZAZIONE

#endif // TEMPIRITORNOL_H
